package com.jinyang.baserouter.degrade

import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.DegradeService
import com.alibaba.android.arouter.facade.Postcard
import com.jinyang.baserouter.PATH_ACTIVITY_ERROR
import com.jinyang.baserouter.log
import com.jinyang.baserouter.routerNavigation

/**
 * @Author: LiuJinYang
 * @CreateDate: 2021/12/8
 * @Description:自定义全局降级策略
 */
@Route(path = "/degrade/Test")
class TestDegradeServiceImpl : DegradeService {
    override fun onLost(context: Context?, postcard: Postcard?) {
        log("TestDegradeServiceImpl.onLost：没有找到该路由地址:${postcard?.path}")
        // do something：可以提供一个错误页进行跳转
        routerNavigation(PATH_ACTIVITY_ERROR)
    }

    override fun init(context: Context?) {
        log("TestDegradeServiceImpl.init")
    }
}